#ifndef __TOYM__NET__CALLABLE_H__
#define __TOYM__NET__CALLABLE_H__

#include <functional>
#include <memory>

namespace toym
{
/////////////////////////////////////////////////////////////////
//////   类型前置声明
/////////////////////////////////////////////////////////////////
class Buffer;
class Timestamp;
namespace net
{

class TcpConnection;
class Socket;
class InetAddress;
class EventLoop;

} // namespace net

///////////////////////////////////////////////////////////////
/////   types
///////////////////////////////////////////////////////////////

using TcpConnectionPtr = std::shared_ptr<toym::net::TcpConnection>;

/////////////////////////////////////////////////////////
/////    callbacks
/////////////////////////////////////////////////////////

using ChannelReadCb_t = std::function<void()>;
using ChannelWriteCb_t = std::function<void()>;
using ChannelCloseCb_t = std::function<void()>;
using ChannelErrorCb_t = std::function<void()>;

using EventLoopFunctor_t = std::function<void()>;

using TimerCallback_t = std::function<void()>;

using ConnectionCallback_t = std::function<void(const TcpConnectionPtr&)>;
using MessageCallback_t = std::function<void(const TcpConnectionPtr&, Buffer*, Timestamp)>;
using CloseCallback_t = std::function<void(const TcpConnectionPtr&)>;
using ErrorCallback_t = std::function<void(const TcpConnectionPtr&)>;
using WriteComplateCallback_t = std::function<void(const TcpConnectionPtr&)>;
using HighWaterMarkCallback_t = std::function<void(const TcpConnectionPtr&, Buffer*)>;

using NewConnectionCallback_t = std::function<void(toym::net::Socket, const toym::net::InetAddress&)>;

using ConnectedCallback_t = std::function<void(int)>;

using ThreadInitCallback_t = std::function<void(toym::net::EventLoop*)>;


} // namespace toym


#endif //__TOYM__NET__CALLABLE_H__